Requests & Response
Description and examples of request and responses
Request
- cURL
- Python
- JavaScript
curl
--location 'https://eu.aimsmedical.ai/risk/api/do/v0' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_AUTHENTICATION_KEY' \
--data '[{
"id": 0,
"age": 24,
"sex": "F",
"inpatientAdmissions": 1,
"emergencyAdmissions": 2,
"stayDays": 40,
... additional fields
}]'
import requests
import json
url = 'https://eu.aimsmedical.ai/risk/api/do/v0'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_AUTHENTICATION_KEY'
}
data = [{
"id": 0,
"age": 24,
"sex": "F",
"inpatientAdmissions": 1,
"emergencyAdmissions": 2,
"stayDays": 40,
# ... additional fields
}]
response = requests.post(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
print("Success:", response.json())
else:
print("Failed:", response.status_code, response.json())
const url = 'https://eu.aimsmedical.ai/risk/api/do/v0';
const headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_AUTHENTICATION_KEY'
};
const data = [{
id: 0,
age: 24,
sex: 'F',
inpatientAdmissions: 1,
emergencyAdmissions: 2,
stayDays: 40,
// ... additional fields
}];
fetch(`${url}`, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log('Success:', data))
.catch(error => console.log('Error:', error));
Response
Example of response for a consultation with a patient:
[{
"id": 0,
"risk": "Yes",
"error_message": null
}]
Example of response for a consultation with multiple patients:
[{
"id": 0,
"risk": null,
"error_message": [{
"Field": "mna_total",
"FieldDate": "11-07-2022",
"ExtendError": "ValueError for value Total in idx 0 (the sum of the values '7.00' does not coincide with the sum provided)"
},
{
"Field": "age",
"FieldDate": "",
"ExtendError": "ValueMissing for value age"
}]
},
{
"id": 1,
"risk": "No",
"error_message": [{
"Field": "barthel_chairTransfers",
"FieldDate": "25-08-2021",
"ExtendError": "ValueError for value ChairTransfers in idx 1 (out of range)"
}]
}]
Parameters are described in Parameters.